package com.example.intermediateactivity.entity;


import com.example.intermediateactivity.R;

import java.util.ArrayList;

public class GoodsInfo {
    public int id;
    public String name;
    public String description;
    public float price;
    // 图片保存路径
    public String picPath;
    // 图片资源编号
    public int pic;

    // 手机名字
    private static String[] NAME_ARRAY = {
            "iPhone11",
            "Mate30",
            "小米11",
            "OPPO Reno3",
            "vivo X3",
            "荣耀30s"
    };
    // 手机描述
    private static String[] DESC_ARRAY = {
            "Apple iPhone11 256GB 绿色 4G全网通",
            "华为 HUAWEI Mate30 8GB+256GB 橙色 5G全网通，全面屏手机",
            "小米 MI10 8GB+128GB 黑色 5G手机 游戏拍照手机",
            "OPPO Reno3 8GB+128GB 蓝色 双模5G 拍照游戏智能手机",
            "vivo X30 8GB+128GB 橙色 5G全网通 美颜拍照手机",
            "荣耀30s 8GB+128GB 红色 5G芯片 自拍全面屏手机",
    };

    // 手机价格
    private static float[] PRICE_ARRAY = {
            6299, 4999, 3999, 2999, 2998, 2399
    };

    // 手机图片
    private static int[] PICTURE_ARRAY = {
            R.drawable.pic_ihpne11,
            R.drawable.pic_mate30,
            R.drawable.pic_xiaomi11,
            R.drawable.pic_oppo_reno3,
            R.drawable.pic_vivox3,
            R.drawable.pic_honour30s
    };

    // 默认手机列表
    public static ArrayList<GoodsInfo> getDefaultList() {
        ArrayList<GoodsInfo> goodsList = new ArrayList<>();
        for (int i = 0; i < NAME_ARRAY.length; i++) {
            GoodsInfo info = new GoodsInfo();
            info.id = i;
            info.name = NAME_ARRAY[i];
            info.description = DESC_ARRAY[i];
            info.price = PRICE_ARRAY[i];
            info.pic = PICTURE_ARRAY[i];
            goodsList.add(info);
        }
        return goodsList;
    }


    @Override
    public String toString() {
        return "GoodsInfo{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", price=" + price +
                ", picPath='" + picPath + '\'' +
                ", pic=" + pic +
                '}';
    }
}
